#include "cmd_1.h"

#include <QApplication>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QWidget>
#pragma comment(lib, "user32.lib")

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    //创建窗口控件
    QLabel *infoLabel = new QLabel;
    QLabel *openLabel = new QLabel;
    //创建文本框控件
    QLineEdit *cmdLineEdit = new QLineEdit;
    //创建按钮控件
    QPushButton *commitButton = new QPushButton;
    QPushButton *cancelButton = new QPushButton;
    QPushButton *browseButton = new QPushButton;

    //设置文本框和按钮的文本
    infoLabel->setText("请输入命令：");
    openLabel->setText("打开");
    commitButton->setText("确定");
    cancelButton->setText("取消");
    browseButton->setText("浏览");

    //创建水平布局管理器
    QHBoxLayout *hLayout = new QHBoxLayout;
    hLayout->addWidget(openLabel);
    hLayout->addWidget(cmdLineEdit);
    
    QHBoxLayout *buttonlayout = new QHBoxLayout;
    buttonlayout->addWidget(commitButton);
    buttonlayout->addWidget(cancelButton);
    buttonlayout->addWidget(browseButton);


    //创建垂直布局管理器
    QVBoxLayout *vLayout = new QVBoxLayout;
    vLayout->addWidget(infoLabel);  //将文本框控件添加到水平布局管理器中
    vLayout->addLayout(hLayout);   //将水平布局管理器添加到垂直布局管理器中
    vLayout->addLayout(buttonlayout); //将按钮水平布局添加到垂直布局中


    // cmd_1 w;
    QWidget w;
    w.setLayout(vLayout); //将垂直布局管理器添加到窗口中
    w.show();
    w.setWindowTitle("cmd");
    return a.exec();
}